package cn.maihe.elg.operation.repository.entity;

import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@TableName("t_refund_order_info")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.RefundOrderInfoMapper")
public class RefundOrderInfoDO extends BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 机构主键id
     */
    @TableField(value = "org_id")
    private Long orgId;

    /**
     * 保函编号
     */
    @TableField(value = "guarantee_no")
    private String guaranteeNo;

    /**
     * 交易中心订单号
     */
    @TableField(value = "center_order_id")
    private String centerOrderId;

    /**
     * 退款订单号
     */
    @TableField(value = "refund_order_no")
    private String refundOrderNo;

    /**
     * 受理投保订单号
     */
    @TableField(value = "accept_order_no")
    private String acceptOrderNo;

    /**
     * 申请开函订单号
     */
    @TableField(value = "apply_order_no")
    private String applyOrderNo;

    /**
     * 项目名称
     */
    @TableField(value = "project_name")
    private String projectName;

    /**
     * 合同/工程/标段名称
     */
    @TableField(value = "section_name")
    private String sectionName;

    /**
     * 申请企业名称/被担保企业
     */
    @TableField(value = "bid_customer_name")
    private String bidCustomerName;

    /**
     * 投标截止日期
     */
    @TableField(value = "bid_indate")
    private Date bidIndate;

    /**
     * 保函类型
     */
    @TableField(value = "guarantee_type")
    private String guaranteeType;

    /**
     * 保函品种
     */
    @TableField(value = "guarantee_category")
    private String guaranteeCategory;

    /**
     * 投标保证金/担保金额分
     */
    @TableField(value = "bid_bond")
    private Long bidBond;

    /**
     * 保费金额分
     */
    @TableField(value = "guarantee_fee")
    private Long guaranteeFee;

    /**
     * 开函机构名称
     */
    @TableField(value = "institution_name")
    private String institutionName;

    /**
     * 退款金额
     */
    @TableField(value = "refund_amount")
    private String refundAmount;

    /**
     * 我的售后订单状态数字字典
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 投保项目主键id
     */
    @TableField(value = "project_id")
    private Long projectId;

    /**
     * 投保客户主键id
     */
    @TableField(value = "bid_customer_id")
    private Long bidCustomerId;

    /**
     * 开函机构主键id
     */
    @TableField(value = "institution_id")
    private Long institutionId;

    /**
     * 交易中心主键id
     */
    @TableField(value = "center_id")
    private Long centerId;

    /**
     * 关联附件表主键id
     */
    @TableField(value = "attachment_id")
    private Long attachmentId;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    /**
     * 创建用户
     */
    @TableField(value = "user_create", fill = FieldFill.INSERT)
    private String userCreate;

    /**
     * 更新用户
     */
    @TableField(value = "user_modified", fill = FieldFill.INSERT_UPDATE)
    private String userModified;

    /**
     * 备注说明
     */
    @TableField(value = "remark")
    private String remark;

    /**
     * 邀请码8位：配合交易中心推送信息关联
     */
    @TableField(value = "invite_code")
    private String inviteCode;

    /**
     * 收款账号
     */
    @TableField(value = "payer_account")
    private String payerAccount;

    /**
     * 赔付金额
     */
    @TableField(value = "payer_amount")
    private String payerAmount;

    /**
     * 理赔文件列表json数组格式
     */
    @TableField(value = "file_list")
    private String fileList;

    /**
     * 理赔联系人
     */
    @TableField(value = "apply_user_name")
    private String applyUserName;

    /**
     * 理赔联系人电话
     */
    @TableField(value = "apply_user_phone")
    private String applyUserPhone;

    /**
     * 赔付日期
     */
    @TableField(value = "compensate_date")
    private Date compensateDate;

    /**
     * 转账日期
     */
    @TableField(value = "transfer_date")
    private Date transferDate;
    /**
     * 赔付方式，1保险公司赔付 2投标单位赔付"
     */
    @TableField(value = "compensate_way")
    private Integer compensateWay;

    /**
     * 转账凭证列表json数组格式
     */
    @TableField(value = "transfer_file_list")
    private String transferFileList;
    public RefundOrderInfoVo buildVo() {
        return new RefundOrderInfoVo(id, orgId, guaranteeNo, centerOrderId, refundOrderNo, acceptOrderNo, applyOrderNo, projectName, sectionName, bidCustomerName, bidIndate, guaranteeType, guaranteeCategory, bidBond, guaranteeFee, institutionName, refundAmount, status, projectId, bidCustomerId, institutionId, centerId, attachmentId, gmtCreate, gmtModified, userCreate, userModified, remark, inviteCode, payerAccount, payerAmount, fileList, applyUserName, applyUserPhone, compensateDate, transferDate, compensateWay, transferFileList);
    }

    public static RefundOrderInfoDO of(RefundOrderInfoVo vo) {
        return new RefundOrderInfoDO(vo.getId(), vo.getOrgId(), vo.getGuaranteeNo(), vo.getCenterOrderId(), vo.getRefundOrderNo(), vo.getAcceptOrderNo(), vo.getApplyOrderNo(), vo.getProjectName(), vo.getSectionName(), vo.getBidCustomerName(), vo.getBidIndate(), vo.getGuaranteeType(), vo.getGuaranteeCategory(), vo.getBidBond(), vo.getGuaranteeFee(), vo.getInstitutionName(), vo.getRefundAmount(), vo.getStatus(), vo.getProjectId(), vo.getBidCustomerId(), vo.getInstitutionId(), vo.getCenterId(), vo.getAttachmentId(), vo.getGmtCreate(), vo.getGmtModified(), vo.getUserCreate(), vo.getUserModified(), vo.getRemark(), vo.getInviteCode(), vo.getPayerAccount(), vo.getPayerAmount(), vo.getFileList(), vo.getApplyUserName(), vo.getApplyUserPhone(), vo.getCompensateDate(),vo.getTransferDate(), vo.getCompensateWay(),  vo.getTransferFileList());
    }
}
